package com.ibm.cps.message;

import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.ibm.cps.message.MessageFactory.MessageType;

public class StatusMessage extends AbstractMessage {
	private String status;
	private String server;

	public StatusMessage(byte[] statusMessage) {
		String statusStr = new String(statusMessage);
		JsonParser parser = new JsonParser();
		JsonObject schemaObject = parser.parse(statusStr).getAsJsonObject();
		tenantid = schemaObject.get("tenantid").getAsString();
		status = schemaObject.get("status").getAsString();
		server = schemaObject.get("server").getAsString();
		type = MessageType.SERVER_STATUS;
		System.out.println("In status constructure.");
	}

	@Override
	public String getUserId() {
		return tenantid;
	}

	@Override
	public MessageType getMessageType() {
		return type;
	}

	public String getStatus() {
		return status;
	}

	public String getServer() {
		return server;
	}

}
